﻿<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ include file="/WEB-INF/view/include/inc.jsp"%>

<!DOCTYPE html>
<html lang="en">
<head>
<%@ include file="../../jQgrid.jsp"%>
</head>
<body>
	<div class="container-fluid" id="main-container">
		<div id="page-content" class="clearfix">
			<div class="row">
			<div class="col-sm-12">
				<div class="tabs-container">
					<ul class="nav nav-tabs">
						<li class="active" id="zcs"><a data-toggle="tab" onClick="zc();" 
							aria-expanded="true">系统操作</a></li>
						<li class="" id="ycs"><a data-toggle="tab" onClick="yc();" 
							aria-expanded="true">系统异常</a></li>
					</ul>
					<div class="ibox-content" style=" padding-left: 0px; margin-top: 10px;"  id="table1">
						<div class="jqGrid_wrapper">
							<table id="table_list_1"></table>
							<div id="pager_list_1"></div>
						</div>
					</div>
					
					<div class="ibox-content" style=" padding-left: 0px; margin-top: 10px;" id="table2">
						<div class="jqGrid_wrapper">
							<table id="table_list_2"></table>
							<div id="pager_list_2"></div>
						</div>
					</div>
				</div>
			</div>
		</div>
			<!--/row-->
		</div>
		<!--/#page-content-->
	</div>
	<!--/.fluid-container#main-container-->


	<script type="text/javascript">
		$(function(){
			$("#table2").hide();
			$(top.hangge());
			$.jgrid.defaults.styleUI = "Bootstrap";
			$("#table_list_1").jqGrid({
				url: '<%=contextPath%>/log/listData',
				data : {},
				datatype : "json",
				autowidth : true,
				shrinkToFit : true,
				mtype : "post",
				rowNum : 20,
				rowList : [ 10, 20, 30 ],
				colNames : ["id", "描述","操作人","操作时间","请求IP"],
				colModel : [{
					name : "id",
					index : "id",
					hidden:true
				},  {
					name : "description",
					index : "description",
					width : 50
				},  {
					name : "operatorName",
					index : "operator_name",
					width : 50
				},  {
					name : "createDate",
					index : "create_date",
					width : 50,
					formatter:"date",
					formatoptions: {srcformat:'Y-m-d H:i:s',newformat:'Y-m-d H:i:s'}
				},  {
					name : "requestIp",
					index : "request_ip",
					width : 50
				}],
				pager : "#pager_list_1",
				viewrecords : true,
				height : $(window).height() - 160,
				hidegrid : false,
				refresh : true
			}).navGrid('#pager_list_1',{edit:false,add:false,del:false,search:true,refresh:true});
		});
		
		function yc(){
			$("#ycs").attr('class','active'); 
			$("#zcs").attr('class',''); 
			$("#table1").hide();
			$("#table2").show();
			$("#table_list_2").trigger("reloadGrid");
		}
		function zc(){
			$("#ycs").attr('class',''); 
			$("#zcs").attr('class','active'); 
			$("#table2").hide();
			$("#table1").show();
			$("#table_list_1").trigger("reloadGrid");
		}
		
	</script>
	
	
	<script type="text/javascript">
	$(function() {
		$("#table_list_2").jqGrid({
			url: '<%=contextPath%>/log/listExceptionData',
			data : {},
			datatype : "json",
			autowidth : true,
			shrinkToFit : true,
			mtype : "post",
			rowNum : 20,
			rowList : [ 10, 20, 30 ],
			colNames : ["id", "描述","操作人","操作时间","异常代码","请求IP"],
			colModel : [{
				name : "id",
				index : "id",
				hidden:true
			},  {
				name : "description",
				index : "description",
				width : 50
			},  {
				name : "operatorName",
				index : "operator_name",
				width : 50
			},  {
				name : "createDate",
				index : "create_date",
				width : 50
			},  {
				name : "exceptionCode",
				index : "exception_code",
				width : 50
			},  {
				name : "requestIp",
				index : "request_ip",
				width : 50
			}],
			pager : "#pager_list_2",
			viewrecords : true,
			height : $(window).height() - 160,
			hidegrid : false,
			refresh : true,
		}).navGrid('#pager_list_2',{edit:false,add:false,del:false,search:true,refresh:true});
		
		$(window).bind("resize", function() {
			var a = $("#panel-body-1").width()
			var b = $("#panel-body-2").width()
			if(a>0){
				b=a;
			}
			$("#table_list_2").setGridWidth(b);
			$("#table_list_2").setGridHeight($(window).height() - 160);
			$("#table_list_1").setGridWidth(b);
			$("#table_list_1").setGridHeight($(window).height() - 160);
		})
		var b = $(".jqGrid_wrapper").width();
		$("#table_list_2").setGridWidth(b);
	});
		
	</script>
	
</body>
</html>

